<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/*****************************************************************************
<span class='line'>  2</span> * Cal3D 3d character animation library
<span class='line'>  3</span> * Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger
<span class='line'>  4</span> *
<span class='line'>  5</span> * This library is free software; you can redistribute it and/or modify it
<span class='line'>  6</span> * under the terms of the GNU Lesser General Public License as published by
<span class='line'>  7</span> * the Free Software Foundation; either version 2.1 of the License, or (at
<span class='line'>  8</span> * your option) any later version.
<span class='line'>  9</span> *****************************************************************************/</span><span class="WHIT">
<span class='line'> 10</span> 
<span class='line'> 11</span> </span><span class="COMM">/*****************************************************************************
<span class='line'> 12</span> * Cal3DJS Javascript port of Cal3D for WebGL and canvas applications
<span class='line'> 13</span> * by Humu humu2009@gmail.com
<span class='line'> 14</span> * http://code.google.com/p/cal3djs/
<span class='line'> 15</span> *****************************************************************************/</span><span class="WHIT">
<span class='line'> 16</span> 
<span class='line'> 17</span> 
<span class='line'> 18</span> </span><span class="COMM">/**
<span class='line'> 19</span> 	@class CalAbstractMixer
<span class='line'> 20</span> 
<span class='line'> 21</span> 	CalAbstractMixer defines the API that CalModel relies on for blending and scheduling animations.&lt;br />
<span class='line'> 22</span> 	A third party mixer must implement this API in order to register itself with the CalModel.setAbstractMixer method. 
<span class='line'> 23</span> 	The default mixer (CalMixer) is an example of such implementation.&lt;br />&lt;br />
<span class='line'> 24</span> 
<span class='line'> 25</span> 	Cal3D expects a mixer to handle two tasks: scheduling and blending. Scheduling refers to everything related to time such 
<span class='line'> 26</span> 	as when an animation must run or when it must stop. Blending defines how concurrent animations influence each other: for 
<span class='line'> 27</span> 	instance walking and waving.&lt;br />&lt;br />
<span class='line'> 28</span> 
<span class='line'> 29</span> 	If CalMixer proves to be insufficient for the applications needs, an alternate mixer can be implemented and used without 
<span class='line'> 30</span> 	notifying Cal3D in any way. It is not mandatory to subclass CalAbstractMixer. However, when chosing this path, one must 
<span class='line'> 31</span> 	also avoid using the CalModel.update method because it would use the default mixer instantiated by the CalModel.create method 
<span class='line'> 32</span> 	with undesirable side effects. In addition libraries based on Cal3D (think NebulaDevice or OpenSceneGraph adapters) are 
<span class='line'> 33</span> 	not aware of these constraints and will keep calling the CalModel.update method of CalModel regardless.&lt;br />&lt;br />
<span class='line'> 34</span> 
<span class='line'> 35</span> 	Subclassing CalAbstractMixer when implementing an alternate mixer therefore provides a better integration with Cal3D and 
<span class='line'> 36</span> 	libraries that rely on CalModel. However, an additional effort is required in order to achieve compatibility with libraries or 
<span class='line'> 37</span> 	applications that rely on the CalMixer API (i.e. that use methods such as blendCycle or executeAction).  The CalMixer API is not 
<span class='line'> 38</span> 	meant to be generic and there is no reason to define an abstract class that specifies it. For historical reasons and because 
<span class='line'> 39</span> 	CalMixer is the default mixer, some applications and libraries (think Soya or CrystalSpace) depend on it. If they want to switch 
<span class='line'> 40</span> 	to a scheduler with extended capabilities it might be painfull for them to learn a completely different API. A scheduler with the 
<span class='line'> 41</span> 	ambition to obsolete CalMixer should therefore provide an API compatible with it to ease the migration process.&lt;br />&lt;br />
<span class='line'> 42</span> 
<span class='line'> 43</span> 	Short summary, if you want to write a new mixer:&lt;br />&lt;br />
<span class='line'> 44</span> 
<span class='line'> 45</span> 	1) An external mixer: ignore CalAbstractMixer and implement a mixer of your own. Avoid calling CalModel.update and any library or 
<span class='line'> 46</span> 	application that will call it behind your back. Avoid libraries and applications that rely on the default mixer CalMixer, as returned 
<span class='line'> 47</span> 	by CalModel.getMixer.&lt;br />&lt;br />
<span class='line'> 48</span> 
<span class='line'> 49</span> 	2) A mixer registered in Cal3D: subclass CalAbstractMixer, register it with CalModel.setAbstractMixer.  Avoid libraries and 
<span class='line'> 50</span> 	applications that rely on the default mixer CalMixer, as returned by CalModel.getMixer. CalModel.getMixer will return a null 
<span class='line'> 51</span> 	pointer if CalModel.setAbstractMixer was called to set a mixer that is not an instance of CalMixer.&lt;br />&lt;br />
<span class='line'> 52</span> 
<span class='line'> 53</span> 	3) A CalMixer replacement: same as 2) and provide a subclass of your own mixer that implements the CalMixer API so that existing 
<span class='line'> 54</span> 	applications can switch to it by calling CalModel.getAbstractMixer instead of CalModel.getMixer. The existing code using the CalMixer 
<span class='line'> 55</span> 	methods will keep working and the developper will be able to switch to a new API when convenient.
<span class='line'> 56</span> */</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="NAME">Cal3D.CalAbstractMixer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 59</span> 
<span class='line'> 60</span> </span><span class="COMM">/**
<span class='line'> 61</span> 	See if the object is an instance of the default mixer (i.e. Cal3D.CalMixer).&lt;br />
<span class='line'> 62</span> 	@returns {boolean} true, if the object is an instance of Cal3D.CalMixer; false if not.
<span class='line'> 63</span> */</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="NAME">Cal3D.CalAbstractMixer.prototype.isDefaultMixer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 66</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 67</span> 
<span class='line'> 68</span> </span><span class="COMM">/**
<span class='line'> 69</span> 	Notify the instance that updateAnimation was last called eltaTime seconds ago. The internal scheduler of the instance 
<span class='line'> 70</span> 	should terminate animations or update the timing information of active animations accordingly. It should not blend animations 
<span class='line'> 71</span> 	together or otherwise modify the CalModel associated to these animations.&lt;br />br />
<span class='line'> 72</span> 	
<span class='line'> 73</span> 	The CalModel.update method will call updateSkeleton immediately after updateAnimation if the instance was allocated by 
<span class='line'> 74</span> 	CalModel.create (in which case it is a CalMixer instance) or if the instance was set via CalModel.setAbstractMixer.
<span class='line'> 75</span> 
<span class='line'> 76</span> 	@param {number} deltaTime The elapsed time in seconds since the last call.
<span class='line'> 77</span> */</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="NAME">Cal3D.CalAbstractMixer.prototype.updateAnimation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">deltaTime</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">'abstract method error'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 81</span> 
<span class='line'> 82</span> </span><span class="COMM">/**
<span class='line'> 83</span> 	Update the skeleton of the corresponding CalModel (as provided to the create method) to match the current animation state (as 
<span class='line'> 84</span> 	updated by the last call to updateAnimation).  The tracks of each active animation are blended to compute the position and 
<span class='line'> 85</span> 	orientation of each bone of the skeleton. The updateAnimation method should be called just before calling updateSkeleton to 
<span class='line'> 86</span> 	define the set of active animations.&lt;br />&lt;br />
<span class='line'> 87</span> 
<span class='line'> 88</span> 	The CalModel.update method will call updateSkeleton immediately after updateAnimation if the instance was allocated by 
<span class='line'> 89</span> 	CalModel.create (in which case it is a CalMixer instance) or if the instance was set via CalModel.setAbstractMixer.
<span class='line'> 90</span> */</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="NAME">Cal3D.CalAbstractMixer.prototype.updateSkeleton</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">'abstract method error'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 94</span> 
<span class='line'> 95</span> 
<span class='line'> 96</span> 
<span class='line'> 97</span> </span><span class="COMM">/**
<span class='line'> 98</span> 	@class CalMixer
<span class='line'> 99</span> */</span><span class="WHIT">
<span class='line'>100</span> </span><span class="NAME">Cal3D.CalMixer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">model</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>101</span> </span><span class="WHIT">	</span><span class="NAME">this.m_model</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">model</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">	</span><span class="NAME">this.m_vectorAnimation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="NAME">model.getCoreModel</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">getCoreAnimationCount</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>103</span> </span><span class="WHIT">	</span><span class="NAME">this.m_listAnimationAction</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>104</span> </span><span class="WHIT">	</span><span class="NAME">this.m_listAnimationCycle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>105</span> </span><span class="WHIT">	</span><span class="NAME">this.m_animationTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">	</span><span class="NAME">this.m_animationDuration</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">	</span><span class="NAME">this.m_timeFactor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>108</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>109</span> 
<span class='line'>110</span> </span><span class="COMM">// inherited from CalAbstractMixer</span><span class="WHIT">
<span class='line'>111</span> </span><span class="NAME">Cal3D.CalMixer.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Cal3D.CalAbstractMixer</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>112</span> 
<span class='line'>113</span> </span><span class="COMM">/**
<span class='line'>114</span> 	See if the object is an instance of Cal3D.CalMixer.&lt;br />
<span class='line'>115</span> 	@returns {boolean} Always return true. 
<span class='line'>116</span> */</span><span class="WHIT">
<span class='line'>117</span> </span><span class="NAME">Cal3D.CalMixer.prototype.isDefaultMixer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>118</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>119</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>120</span> 
<span class='line'>121</span> </span><span class="COMM">/**
<span class='line'>122</span> 	Interpolate the weight of an animation cycle.&lt;br />
<span class='line'>123</span> 	This function interpolates the weight of an animation cycle to a new value in a given amount of time. If the specified 
<span class='line'>124</span> 	animation cycle is not active yet, it is activated.
<span class='line'>125</span> 	@param {number} id The ID of the animation cycle to be blended.
<span class='line'>126</span> 	@param {number} weight The weight to interpolate the animation cycle to.
<span class='line'>127</span> 	@param {number} delay The time in seconds until the new weight should be reached.
<span class='line'>128</span> 	@returns {boolean} true if succeeded; false if any error happened.
<span class='line'>129</span> */</span><span class="WHIT">
<span class='line'>130</span> </span><span class="NAME">Cal3D.CalMixer.prototype.blendCycle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">weight</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">delay</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>131</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">this.m_vectorAnimation.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>132</span> </span><span class="WHIT">		</span><span class="NAME">Cal3D.CalError.setLastError</span><span class="PUNC">(</span><span class="NAME">Cal3D.CalError.Code.INVALID_HANDLE</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'mixer.js'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>133</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>134</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>135</span> 
<span class='line'>136</span> </span><span class="WHIT">	</span><span class="COMM">// get the animation for the given id</span><span class="WHIT">
<span class='line'>137</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.m_vectorAnimation</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>138</span> 
<span class='line'>139</span> </span><span class="WHIT">	</span><span class="COMM">// create a new animation instance if it is not active yet</span><span class="WHIT">
<span class='line'>140</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">animation</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT">		</span><span class="COMM">// take the fast way out if we are trying to clear an inactive animation</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">weight</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>143</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>144</span> 
<span class='line'>145</span> </span><span class="WHIT">		</span><span class="COMM">// get the core animation</span><span class="WHIT">
<span class='line'>146</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">coreAnimation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.m_model.getCoreModel</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">getCoreAnimation</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>147</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">coreAnimation</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>148</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>149</span> 
<span class='line'>150</span> </span><span class="WHIT">		</span><span class="COMM">// ensure that the animation's first and last key frame match for proper looping</span><span class="WHIT">
<span class='line'>151</span> </span><span class="WHIT">		</span><span class="NAME">Cal3D.addExtraKeyframeForLoopedAnim</span><span class="PUNC">(</span><span class="NAME">coreAnimation</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>152</span> 
<span class='line'>153</span> </span><span class="WHIT">		</span><span class="COMM">// create a new animation cycle instance</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationCycle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Cal3D.CalAnimationCycle</span><span class="PUNC">(</span><span class="NAME">coreAnimation</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>155</span> 
<span class='line'>156</span> </span><span class="WHIT">		</span><span class="COMM">// insert the new animation into the tables</span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT">		</span><span class="NAME">this.m_vectorAnimation</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">animationCycle</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT">		</span><span class="NAME">this.m_listAnimationCycle.unshift</span><span class="PUNC">(</span><span class="NAME">animationCycle</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>159</span> 
<span class='line'>160</span> </span><span class="WHIT">		</span><span class="COMM">// blend the animation</span><span class="WHIT">
<span class='line'>161</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">animationCycle.blend</span><span class="PUNC">(</span><span class="NAME">weight</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">delay</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>162</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>163</span> 
<span class='line'>164</span> </span><span class="WHIT">	</span><span class="COMM">// check if this is really an animation cycle instance</span><span class="WHIT">
<span class='line'>165</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">animation.getType</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">Cal3D.CalAnimation.Type.TYPE_CYCLE</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>166</span> </span><span class="WHIT">		</span><span class="NAME">Cal3D.CalError.setLastError</span><span class="PUNC">(</span><span class="NAME">Cal3D.CalError.Code.INVALID_ANIMATION_TYPE</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'mixer.js'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>167</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>168</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>169</span> 
<span class='line'>170</span> </span><span class="WHIT">	</span><span class="COMM">// clear the animation cycle from the active vector if the target weight is zero</span><span class="WHIT">
<span class='line'>171</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">weight</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>172</span> </span><span class="WHIT">		</span><span class="NAME">this.m_vectorAnimation</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>173</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>174</span> 
<span class='line'>175</span> </span><span class="WHIT">	</span><span class="COMM">// cast it to an animation cycle</span><span class="WHIT">
<span class='line'>176</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationCycle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">animation</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>177</span> 
<span class='line'>178</span> </span><span class="WHIT">	</span><span class="COMM">// blend the animation cycle</span><span class="WHIT">
<span class='line'>179</span> </span><span class="WHIT">	</span><span class="NAME">animationCycle.blend</span><span class="PUNC">(</span><span class="NAME">weight</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">delay</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>180</span> </span><span class="WHIT">	</span><span class="NAME">animationCycle.checkCallbacks</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.m_model</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>181</span> 
<span class='line'>182</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>183</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>184</span> 
<span class='line'>185</span> </span><span class="COMM">/**
<span class='line'>186</span> 	Fade an animation cycle out.&lt;br />
<span class='line'>187</span> 	This function fades an animation cycle out in a given amount of time.
<span class='line'>188</span> 	@param {number} id The ID of the animation cycle to be faded out.
<span class='line'>189</span> 	@param {number} delay The time in seconds until the the animation cycle is completely removed.
<span class='line'>190</span> 	@returns {boolean} true if succeeded; false if any error happened.
<span class='line'>191</span> */</span><span class="WHIT">
<span class='line'>192</span> </span><span class="NAME">Cal3D.CalMixer.prototype.clearCycle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">delay</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>193</span> </span><span class="WHIT">	</span><span class="COMM">// check if the animation id is valid</span><span class="WHIT">
<span class='line'>194</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">this.m_vectorAnimation.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>195</span> </span><span class="WHIT">		</span><span class="NAME">Cal3D.CalError.setLastError</span><span class="PUNC">(</span><span class="NAME">Cal3D.CalError.Code.INVALID_HANDLE</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'mixer.js'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>196</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>197</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>198</span> 
<span class='line'>199</span> </span><span class="WHIT">	</span><span class="COMM">// get the animation for the given id</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.m_vectorAnimation</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>201</span> 
<span class='line'>202</span> </span><span class="WHIT">	</span><span class="COMM">// we can only clear cycles that are active</span><span class="WHIT">
<span class='line'>203</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">animation</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>204</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>205</span> 
<span class='line'>206</span> </span><span class="WHIT">	</span><span class="COMM">// check if this is really a animation cycle instance</span><span class="WHIT">
<span class='line'>207</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">animation.getType</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">Cal3D.CalAnimation.Type.TYPE_CYCLE</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>208</span> </span><span class="WHIT">		</span><span class="NAME">Cal3D.CalError.setLastError</span><span class="PUNC">(</span><span class="NAME">Cal3D.CalError.Code.INVALID_ANIMATION_TYPE</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'mixer.js'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>209</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>210</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>211</span> 
<span class='line'>212</span> </span><span class="WHIT">	</span><span class="COMM">// clear the animation cycle from the active vector</span><span class="WHIT">
<span class='line'>213</span> </span><span class="WHIT">	</span><span class="NAME">this.m_vectorAnimation</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>214</span> 
<span class='line'>215</span> </span><span class="WHIT">	</span><span class="COMM">// cast it to an animation cycle</span><span class="WHIT">
<span class='line'>216</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationCycle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">animation</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>217</span> 
<span class='line'>218</span> </span><span class="WHIT">	</span><span class="COMM">// set animation cycle to async state</span><span class="WHIT">
<span class='line'>219</span> </span><span class="WHIT">	</span><span class="NAME">animationCycle.setAsync</span><span class="PUNC">(</span><span class="NAME">this.m_animationTime</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.m_animationDuration</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>220</span> 
<span class='line'>221</span> </span><span class="WHIT">	</span><span class="COMM">// blend the animation cycle</span><span class="WHIT">
<span class='line'>222</span> </span><span class="WHIT">	</span><span class="NAME">animationCycle.blend</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">delay</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>223</span> </span><span class="WHIT">	</span><span class="NAME">animationCycle.checkCallbacks</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.m_model</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>224</span> 
<span class='line'>225</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>226</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>227</span> 
<span class='line'>228</span> </span><span class="COMM">/**
<span class='line'>229</span> 	Execute an animation action.&lt;br />
<span class='line'>230</span> 	This function executes an animation action.
<span class='line'>231</span> 	@param {number} id The ID of the animation action to be execute.
<span class='line'>232</span> 	@param {number} delayIn  The time in seconds until the animation action reaches the full weight from the beginning of its execution.
<span class='line'>233</span> 	@param {number} delayOut The time in seconds in which the animation action reaches zero weight at the end of its execution.
<span class='line'>234</span> 	@param {number} weightTarget The weight to interpolate the animation action to.
<span class='line'>235</span> 	@param {boolean} autoLock This prevents the action from being reset and removed on the last keyframe if true.
<span class='line'>236</span> 	@returns {boolean} true if succeeded; false if any error happened.
<span class='line'>237</span> */</span><span class="WHIT">
<span class='line'>238</span> </span><span class="NAME">Cal3D.CalMixer.prototype.executeAction</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">delayIn</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">delayOut</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">weightTarget</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">autoLock</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>239</span> </span><span class="WHIT">	</span><span class="COMM">// get the core animation</span><span class="WHIT">
<span class='line'>240</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">coreAnimation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.m_model.getCoreModel</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">getCoreAnimation</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>241</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">coreAnimation</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>242</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>243</span> 
<span class='line'>244</span> </span><span class="WHIT">	</span><span class="COMM">// create a new animation action instance</span><span class="WHIT">
<span class='line'>245</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationAction</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Cal3D.CalAnimationAction</span><span class="PUNC">(</span><span class="NAME">coreAnimation</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>246</span> 
<span class='line'>247</span> </span><span class="WHIT">	</span><span class="COMM">// insert the new animation into the table</span><span class="WHIT">
<span class='line'>248</span> </span><span class="WHIT">	</span><span class="NAME">this.m_listAnimationAction.unshift</span><span class="PUNC">(</span><span class="NAME">animationAction</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>249</span> 
<span class='line'>250</span> </span><span class="WHIT">	</span><span class="COMM">// execute the animation</span><span class="WHIT">
<span class='line'>251</span> </span><span class="WHIT">	</span><span class="NAME">animationAction.execute</span><span class="PUNC">(</span><span class="NAME">delayIn</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">delayOut</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">weightTarget</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">autoLock</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>252</span> </span><span class="WHIT">	</span><span class="NAME">animationAction.checkCallbacks</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.m_model</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>253</span> 
<span class='line'>254</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>255</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>256</span> 
<span class='line'>257</span> </span><span class="COMM">/**
<span class='line'>258</span> 	Clear an active animation action.&lt;br />
<span class='line'>259</span> 	This function removes an animation action from the blend list. This is particularly useful with auto-locked actions on their last frame.
<span class='line'>260</span> 	@param {number} id The ID of the animation action to be removed.
<span class='line'>261</span> 	@returns {boolean} true if succeeded; false if the animation does not exist any error happened.
<span class='line'>262</span> */</span><span class="WHIT">
<span class='line'>263</span> </span><span class="NAME">Cal3D.CalMixer.prototype.removeAction</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>264</span> </span><span class="WHIT">	</span><span class="COMM">// get the core animation</span><span class="WHIT">
<span class='line'>265</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">coreAnimation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.m_model.getCoreModel</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">getCoreAnimation</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>266</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">coreAnimation</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>267</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>268</span> 
<span class='line'>269</span> </span><span class="WHIT">	</span><span class="COMM">// update all active animation actions of this model</span><span class="WHIT">
<span class='line'>270</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationActionId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>271</span> </span><span class="WHIT">	</span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">animationActionId</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">this.m_listAnimationAction.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>272</span> </span><span class="WHIT">		</span><span class="COMM">// find the specified action and remove it</span><span class="WHIT">
<span class='line'>273</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.m_listAnimationAction</span><span class="PUNC">[</span><span class="NAME">animationActionId</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">getCoreAnimation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">coreAnimation</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>274</span> </span><span class="WHIT">			</span><span class="COMM">// found, so remove</span><span class="WHIT">
<span class='line'>275</span> </span><span class="WHIT">			</span><span class="NAME">this.m_listAnimationAction</span><span class="PUNC">[</span><span class="NAME">animationActionId</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">completeCallbacks</span><span class="PUNC">(</span><span class="NAME">this.m_model</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>276</span> </span><span class="WHIT">			</span><span class="NAME">this.m_listAnimationAction.splice</span><span class="PUNC">(</span><span class="NAME">animationActionId</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>277</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>278</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>279</span> 
<span class='line'>280</span> </span><span class="WHIT">		</span><span class="NAME">animationActionId</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>281</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>282</span> 
<span class='line'>283</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>284</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>285</span> 
<span class='line'>286</span> </span><span class="COMM">/**
<span class='line'>287</span> 	Update all active animations.&lt;br />
<span class='line'>288</span> 	This function updates all active animations of the mixer instance for a given amount of time.
<span class='line'>289</span> 	@param {number} deltaTime The elapsed time in seconds since the last update.
<span class='line'>290</span> */</span><span class="WHIT">
<span class='line'>291</span> </span><span class="NAME">Cal3D.CalMixer.prototype.updateAnimation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">deltaTime</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>292</span> </span><span class="WHIT">	</span><span class="COMM">// update the current animation time</span><span class="WHIT">
<span class='line'>293</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.m_animationDuration</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>294</span> </span><span class="WHIT">		</span><span class="NAME">this.m_animationTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>295</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>296</span> </span><span class="WHIT">	</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>297</span> </span><span class="WHIT">		</span><span class="NAME">this.m_animationTime</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">deltaTime</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NAME">this.m_timeFactor</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>298</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.m_animationTime</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">this.m_animationDuration</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">this.m_animationTime</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>299</span> </span><span class="WHIT">			</span><span class="NAME">this.m_animationTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.m_animationTime</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NAME">this.m_animationDuration</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>300</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>301</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.m_animationTime</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>302</span> </span><span class="WHIT">			</span><span class="NAME">this.m_animationTime</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.m_animationDuration</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>303</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>304</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>305</span> 
<span class='line'>306</span> </span><span class="WHIT">	</span><span class="COMM">// update all active animation actions of this model</span><span class="WHIT">
<span class='line'>307</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationActionId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>308</span> </span><span class="WHIT">	</span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">animationActionId</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">this.m_listAnimationAction.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>309</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationAction</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.m_listAnimationAction</span><span class="PUNC">[</span><span class="NAME">animationActionId</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>310</span> </span><span class="WHIT">		</span><span class="COMM">// update and check if animation action is still active</span><span class="WHIT">
<span class='line'>311</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">animationAction.update</span><span class="PUNC">(</span><span class="NAME">deltaTime</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>312</span> </span><span class="WHIT">			</span><span class="NAME">animationAction.checkCallbacks</span><span class="PUNC">(</span><span class="NAME">animationAction.getTime</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.m_model</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>313</span> </span><span class="WHIT">			</span><span class="NAME">animationActionId</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>314</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>315</span> </span><span class="WHIT">		</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>316</span> </span><span class="WHIT">			</span><span class="COMM">// animation action has ended, destroy and remove it from the animation list</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT">			</span><span class="NAME">animationAction.completeCallbacks</span><span class="PUNC">(</span><span class="NAME">this.m_model</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT">			</span><span class="NAME">this.m_listAnimationAction.splice</span><span class="PUNC">(</span><span class="NAME">animationActionId</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>319</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>320</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>321</span> 
<span class='line'>322</span> </span><span class="WHIT">	</span><span class="COMM">// TODO: update all active animation poses of this model</span><span class="WHIT">
<span class='line'>323</span> </span><span class="WHIT">	</span><span class="COMM">// ...</span><span class="WHIT">
<span class='line'>324</span> 
<span class='line'>325</span> </span><span class="WHIT">	</span><span class="COMM">// update the weight of all active animation cycles of this model</span><span class="WHIT">
<span class='line'>326</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">accumulatedWeight</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>327</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">accumulatedDuration</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>328</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationCycleId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>329</span> </span><span class="WHIT">	</span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">animationCycleId</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">this.m_listAnimationCycle.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>330</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationCycle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.m_listAnimationCycle</span><span class="PUNC">[</span><span class="NAME">animationCycleId</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>331</span> </span><span class="WHIT">		</span><span class="COMM">// update and check if animation cycle is still active</span><span class="WHIT">
<span class='line'>332</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">animationCycle.update</span><span class="PUNC">(</span><span class="NAME">deltaTime</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>333</span> </span><span class="WHIT">			</span><span class="COMM">// check if it is in sync. if yes, update accumulated weight and duration</span><span class="WHIT">
<span class='line'>334</span> </span><span class="WHIT">			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">animationCycle.getState</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Cal3D.CalAnimation.State.STATE_SYNC</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>335</span> </span><span class="WHIT">				</span><span class="NAME">accumulatedWeight</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">animationCycle.getWeight</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>336</span> </span><span class="WHIT">				</span><span class="NAME">accumulatedDuration</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">animationCycle.getWeight</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NAME">animationCycle.getCoreAnimation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">getDuration</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>337</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>338</span> 
<span class='line'>339</span> </span><span class="WHIT">			</span><span class="NAME">animationCycle.checkCallbacks</span><span class="PUNC">(</span><span class="NAME">this.m_animationTime</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.m_model</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>340</span> </span><span class="WHIT">			</span><span class="NAME">animationCycleId</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>341</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>342</span> </span><span class="WHIT">		</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>343</span> </span><span class="WHIT">			</span><span class="COMM">// animation cycle has ended, destroy and remove it from the animation list</span><span class="WHIT">
<span class='line'>344</span> </span><span class="WHIT">			</span><span class="NAME">animationCycle.completeCallbacks</span><span class="PUNC">(</span><span class="NAME">this.m_model</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>345</span> </span><span class="WHIT">			</span><span class="NAME">this.m_listAnimationCycle.splice</span><span class="PUNC">(</span><span class="NAME">animationCycleId</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>346</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>347</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>348</span> 
<span class='line'>349</span> </span><span class="WHIT">	</span><span class="COMM">// adjust the global animation cycle duration</span><span class="WHIT">
<span class='line'>350</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">accumulatedWeight</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>351</span> </span><span class="WHIT">		</span><span class="NAME">this.m_animationDuration</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">accumulatedDuration</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NAME">accumulatedWeight</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>352</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>353</span> </span><span class="WHIT">	</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>354</span> </span><span class="WHIT">		</span><span class="NAME">this.m_animationDuration</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>355</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>356</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>357</span> 
<span class='line'>358</span> </span><span class="COMM">/**
<span class='line'>359</span> 	Update the skeleton of the corresponding model to match the current animation state.
<span class='line'>360</span> */</span><span class="WHIT">
<span class='line'>361</span> </span><span class="NAME">Cal3D.CalMixer.prototype.updateSkeleton</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>362</span> </span><span class="WHIT">	</span><span class="COMM">// get the skeleton we need to update</span><span class="WHIT">
<span class='line'>363</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">skeleton</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.m_model.getSkeleton</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>364</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">skeleton</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>365</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>366</span> 
<span class='line'>367</span> </span><span class="WHIT">	</span><span class="COMM">// clear the skeleton state</span><span class="WHIT">
<span class='line'>368</span> </span><span class="WHIT">	</span><span class="NAME">skeleton.clearState</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>369</span> 
<span class='line'>370</span> </span><span class="WHIT">	</span><span class="COMM">// get the bone vector of the skeleton</span><span class="WHIT">
<span class='line'>371</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">vectorBone</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">skeleton.getVectorBone</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>372</span> 
<span class='line'>373</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">translation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Cal3D.CalVector</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>374</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">rotation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Cal3D.CalQuaternion</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>375</span> 
<span class='line'>376</span> </span><span class="WHIT">	</span><span class="COMM">// loop through all animation actions</span><span class="WHIT">
<span class='line'>377</span> </span><span class="WHIT">	</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationActionId</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">animationActionId</span><span class="PUNC">&lt;</span><span class="NAME">this.m_listAnimationAction.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">animationActionId</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>378</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationAction</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.m_listAnimationAction</span><span class="PUNC">[</span><span class="NAME">animationActionId</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>379</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'>380</span> </span><span class="WHIT">		</span><span class="COMM">// get the core animation instance</span><span class="WHIT">
<span class='line'>381</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">coreAnimation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">animationAction.getCoreAnimation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>382</span> 
<span class='line'>383</span> </span><span class="WHIT">		</span><span class="COMM">// get the list of core tracks of above core animation</span><span class="WHIT">
<span class='line'>384</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">listCoreTrack</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">coreAnimation.getListCoreTrack</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>385</span> 
<span class='line'>386</span> </span><span class="WHIT">		</span><span class="COMM">// loop through all core tracks of the core animation</span><span class="WHIT">
<span class='line'>387</span> </span><span class="WHIT">		</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">coreTrackId</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">coreTrackId</span><span class="PUNC">&lt;</span><span class="NAME">listCoreTrack.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">coreTrackId</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>388</span> </span><span class="WHIT">			</span><span class="COMM">// get the appropriate bone of the track</span><span class="WHIT">
<span class='line'>389</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">bone</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">vectorBone</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">listCoreTrack</span><span class="PUNC">[</span><span class="NAME">coreTrackId</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">getCoreBoneId</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>390</span> 
<span class='line'>391</span> </span><span class="WHIT">			</span><span class="COMM">// get the current translation and rotation</span><span class="WHIT">
<span class='line'>392</span> </span><span class="WHIT">			</span><span class="NAME">listCoreTrack</span><span class="PUNC">[</span><span class="NAME">coreTrackId</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">getState</span><span class="PUNC">(</span><span class="NAME">animationAction.getTime</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">translation</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rotation</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>393</span> 
<span class='line'>394</span> </span><span class="WHIT">			</span><span class="COMM">// blend the bone state with the new state</span><span class="WHIT">
<span class='line'>395</span> </span><span class="WHIT">			</span><span class="NAME">bone.blendState</span><span class="PUNC">(</span><span class="NAME">animationAction.getWeight</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">translation</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rotation</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>396</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>397</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>398</span> 
<span class='line'>399</span> </span><span class="WHIT">	</span><span class="COMM">// lock the skeleton state</span><span class="WHIT">
<span class='line'>400</span> </span><span class="WHIT">	</span><span class="NAME">skeleton.lockState</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>401</span> 
<span class='line'>402</span> </span><span class="WHIT">	</span><span class="COMM">// loop through all animation cycles</span><span class="WHIT">
<span class='line'>403</span> </span><span class="WHIT">	</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationCycleId</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">animationCycleId</span><span class="PUNC">&lt;</span><span class="NAME">this.m_listAnimationCycle.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">animationCycleId</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>404</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationCycle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.m_listAnimationCycle</span><span class="PUNC">[</span><span class="NAME">animationCycleId</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>405</span> 
<span class='line'>406</span> </span><span class="WHIT">		</span><span class="COMM">// get the core animation instance</span><span class="WHIT">
<span class='line'>407</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">coreAnimation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">animationCycle.getCoreAnimation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>408</span> 
<span class='line'>409</span> </span><span class="WHIT">		</span><span class="COMM">// calculate adjusted time</span><span class="WHIT">
<span class='line'>410</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">animationTime</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>411</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">animationCycle.getState</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Cal3D.CalAnimation.State.STATE_SYNC</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>412</span> </span><span class="WHIT">			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.m_animationDuration</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>413</span> </span><span class="WHIT">				</span><span class="NAME">animationTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>414</span> </span><span class="WHIT">			</span><span class="KEYW">else</span><span class="WHIT">
<span class='line'>415</span> </span><span class="WHIT">				</span><span class="NAME">animationTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.m_animationTime</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NAME">coreAnimation.getDuration</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NAME">this.m_animationDuration</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>416</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>417</span> </span><span class="WHIT">		</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>418</span> </span><span class="WHIT">			</span><span class="NAME">animationTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">animationCycle.getTime</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>419</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>420</span> 
<span class='line'>421</span> </span><span class="WHIT">		</span><span class="COMM">// get the list of core tracks of above core animation</span><span class="WHIT">
<span class='line'>422</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">listCoreTrack</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">coreAnimation.getListCoreTrack</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>423</span> 
<span class='line'>424</span> </span><span class="WHIT">		</span><span class="COMM">// loop through all core tracks of the core animation</span><span class="WHIT">
<span class='line'>425</span> </span><span class="WHIT">		</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">coreTrackId</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">coreTrackId</span><span class="PUNC">&lt;</span><span class="NAME">listCoreTrack.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">coreTrackId</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>426</span> </span><span class="WHIT">			</span><span class="COMM">// get the appropriate bone of the track</span><span class="WHIT">
<span class='line'>427</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">bone</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">vectorBone</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NAME">listCoreTrack</span><span class="PUNC">[</span><span class="NAME">coreTrackId</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">getCoreBoneId</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>428</span> 
<span class='line'>429</span> </span><span class="WHIT">			</span><span class="COMM">// get the current translation and rotation</span><span class="WHIT">
<span class='line'>430</span> </span><span class="WHIT">			</span><span class="NAME">listCoreTrack</span><span class="PUNC">[</span><span class="NAME">coreTrackId</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">getState</span><span class="PUNC">(</span><span class="NAME">animationTime</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">translation</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rotation</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>431</span> 
<span class='line'>432</span> </span><span class="WHIT">			</span><span class="COMM">// blend the bone state with the new state</span><span class="WHIT">
<span class='line'>433</span> </span><span class="WHIT">			</span><span class="NAME">bone.blendState</span><span class="PUNC">(</span><span class="NAME">animationCycle.getWeight</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">translation</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rotation</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>434</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>435</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>436</span> 
<span class='line'>437</span> </span><span class="WHIT">	</span><span class="COMM">// lock the skeleton state</span><span class="WHIT">
<span class='line'>438</span> </span><span class="WHIT">	</span><span class="NAME">skeleton.lockState</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>439</span> 
<span class='line'>440</span> </span><span class="WHIT">	</span><span class="COMM">// let the skeleton calculate its final state</span><span class="WHIT">
<span class='line'>441</span> </span><span class="WHIT">	</span><span class="NAME">skeleton.calculateState</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>442</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>443</span> 
<span class='line'>444</span> </span><span class="COMM">/**
<span class='line'>445</span> 	Get the animation time.&lt;br />
<span class='line'>446</span> 	This function returns the animation time of the mixer instance.
<span class='line'>447</span> 	@returns {number} The animation time in seconds.
<span class='line'>448</span> */</span><span class="WHIT">
<span class='line'>449</span> </span><span class="NAME">Cal3D.CalMixer.prototype.getAnimationTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>450</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.m_animationTime</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>451</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>452</span> 
<span class='line'>453</span> </span><span class="COMM">/**
<span class='line'>454</span> 	Get the animation duration.&lt;br />
<span class='line'>455</span> 	This function returns the animation duration of the mixer instance.
<span class='line'>456</span> 	@returns {number} The animation duration in seconds.
<span class='line'>457</span> */</span><span class="WHIT">
<span class='line'>458</span> </span><span class="NAME">Cal3D.CalMixer.prototype.getAnimationDuration</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>459</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.m_animationDuration</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>460</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>461</span> 
<span class='line'>462</span> </span><span class="COMM">/**
<span class='line'>463</span> 	Set the animation time.&lt;br />
<span class='line'>464</span> 	This function sets the animation time of the mixer instance.
<span class='line'>465</span> 	@param {number} animationTime The animation time to be set.
<span class='line'>466</span> */</span><span class="WHIT">
<span class='line'>467</span> </span><span class="NAME">Cal3D.CalMixer.prototype.setAnimationTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">animationTime</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>468</span> </span><span class="WHIT">	</span><span class="NAME">this.m_animationTime</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">animationTime</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>469</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>470</span> 
<span class='line'>471</span> </span><span class="COMM">/**
<span class='line'>472</span> 	Set the time factor.&lt;br />
<span class='line'>473</span> 	This function sets the time factor of the mixer instance. This time factor affect only sync animation
<span class='line'>474</span> 	@param {number} timeFactor The time factor to be set.
<span class='line'>475</span> */</span><span class="WHIT">
<span class='line'>476</span> </span><span class="NAME">Cal3D.CalMixer.prototype.setTimeFactor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">timeFactor</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>477</span> </span><span class="WHIT">	</span><span class="NAME">this.m_timeFactor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">timeFactor</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>478</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>479</span> 
<span class='line'>480</span> </span><span class="COMM">/**
<span class='line'>481</span> 	Get the time factor.&lt;br />
<span class='line'>482</span> 	This function return the time factor of the mixer instance.
<span class='line'>483</span> 	@returns {number} The time factor.
<span class='line'>484</span> */</span><span class="WHIT">
<span class='line'>485</span> </span><span class="NAME">Cal3D.CalMixer.prototype.getTimeFactor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>486</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.m_timeFactor</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>487</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>488</span> 
<span class='line'>489</span> </span><span class="COMM">/**
<span class='line'>490</span> 	Get the model.&lt;br />
<span class='line'>491</span> 	This function return the CalModel of the mixer instance.
<span class='line'>492</span> 	@returns {Cal3D.CalModel} The model.
<span class='line'>493</span> */</span><span class="WHIT">
<span class='line'>494</span> </span><span class="NAME">Cal3D.CalMixer.prototype.getCalModel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>495</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.m_model</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>496</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>497</span> 
<span class='line'>498</span> </span><span class="COMM">/**
<span class='line'>499</span> 	Get the animation list.&lt;br />
<span class='line'>500</span> 	This function return the animation list of the mixer instance.
<span class='line'>501</span> 	@returns {Array} The animation list.
<span class='line'>502</span> */</span><span class="WHIT">
<span class='line'>503</span> </span><span class="NAME">Cal3D.CalMixer.prototype.getAnimationVector</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>504</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.m_vectorAnimation</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>505</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>506</span> 
<span class='line'>507</span> </span><span class="COMM">/**
<span class='line'>508</span> 	Get the list of the action animations.&lt;br />
<span class='line'>509</span> 	This function return the list of the action animations of the mixer instance.
<span class='line'>510</span> 	@returns {Array} The list of the action animations.
<span class='line'>511</span> */</span><span class="WHIT">
<span class='line'>512</span> </span><span class="NAME">Cal3D.CalMixer.prototype.getAnimationActionList</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>513</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.m_listAnimationAction</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>514</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>515</span> 
<span class='line'>516</span> </span><span class="COMM">/**
<span class='line'>517</span> 	Get the list of the cycle animations.&lt;br />
<span class='line'>518</span> 	This function return the list of the cycle animations of the mixer instance.
<span class='line'>519</span> 	@returns {Array} The list of the cycle animations.
<span class='line'>520</span> */</span><span class="WHIT">
<span class='line'>521</span> </span><span class="NAME">Cal3D.CalMixer.prototype.getAnimationCycle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>522</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.m_listAnimationCycle</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>523</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>524</span> 
<span class='line'>525</span> </span><span class="COMM">/**
<span class='line'>526</span> 	Examine the given animation and if the first and last keyframe of a given track do not match up, the first key frame is duplicated 
<span class='line'>527</span> 	and added to the end of the track to ensure smooth looping.
<span class='line'>528</span> 	@private
<span class='line'>529</span> */</span><span class="WHIT">
<span class='line'>530</span> </span><span class="NAME">Cal3D.addExtraKeyframeForLoopedAnim</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">coreAnimation</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>531</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">listCoreTrack</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">coreAnimation.getListCoreTrack</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>532</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">listCoreTrack.length</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>533</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>534</span> 
<span class='line'>535</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">coreTrackId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>536</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">listCoreTrack</span><span class="PUNC">[</span><span class="NAME">coreTrackId</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>537</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>538</span> 
<span class='line'>539</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">lastKeyframe</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">listCoreTrack</span><span class="PUNC">[</span><span class="NAME">coreTrackId</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">getCoreKeyframe</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">listCoreTrack</span><span class="PUNC">[</span><span class="NAME">coreTrackId</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">getCoreKeyframeCount</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>540</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">lastKeyframe</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>541</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>542</span> 
<span class='line'>543</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">lastKeyframe.getTime</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">coreAnimation.getDuration</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>544</span> </span><span class="WHIT">		</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">coreTrackId</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">coreTrackId</span><span class="PUNC">&lt;</span><span class="NAME">listCoreTrack.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">coreTrackId</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>545</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">coreTrack</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">listCoreTrack</span><span class="PUNC">[</span><span class="NAME">coreTrackId</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>546</span> 
<span class='line'>547</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">firstKeyframe</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">coreTrack.getCoreKeyframe</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>548</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">newKeyframe</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Cal3D.CalCoreKeyframe</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>549</span> 
<span class='line'>550</span> </span><span class="WHIT">			</span><span class="NAME">newKeyframe.setTranslation</span><span class="PUNC">(</span><span class="NAME">firstKeyframe.getTranslation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>551</span> </span><span class="WHIT">			</span><span class="NAME">newKeyframe.setRotation</span><span class="PUNC">(</span><span class="NAME">firstKeyframe.getRotation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>552</span> </span><span class="WHIT">			</span><span class="NAME">newKeyframe.setTime</span><span class="PUNC">(</span><span class="NAME">coreAnimation.getDuration</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>553</span> 
<span class='line'>554</span> </span><span class="WHIT">			</span><span class="NAME">coreTrack.addCoreKeyframe</span><span class="PUNC">(</span><span class="NAME">newKeyframe</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>555</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>556</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>557</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>558</span> </span></pre></body></html>